package com.kitty.annotation.action;

import java.io.PrintWriter;

import javax.servlet.http.*;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.stereotype.Controller;


@Controller
public class AnnotationMultiActionController {

	@RequestMapping(value = "/owner", method = RequestMethod.GET)
	public String ownerHandler(@RequestParam int id,HttpServletRequest request) {
		System.out.println("AnnotationMultiActionController,id=" + id);
		//ModelMap result = new ModelMap("owner");
		request.setAttribute("abc", "abcddddddddddd");
		return "/owner";
	}
	
	@RequestMapping(value = "/owner2", method = RequestMethod.GET)
	public ModelAndView modelAndView(@RequestParam int id,HttpServletRequest request) {
		System.out.println("AnnotationMultiActionController2,id=" + id);
		//ModelMap result = new ModelMap("owner");
		//request.setAttribute("abc", "abcddddddddddd");
		ModelAndView result = new ModelAndView("owner");
		result.addObject("abc", "attributeValue");
		return result;
	}
	
	@RequestMapping(value = "/noResult", method = RequestMethod.GET)
	public void noResult(@RequestParam int id,PrintWriter out) {
		System.out.println("AnnotationMultiActionController2,id=" + id);
		out.println("print into page!");
		out.flush();
		out.close();
	}
	
}
